<template>
	<view class="content">
		<view>{{fullname1}}</view>
		<view>{{fullname2}}</view>
	</view>
</template>

<script setup>
	import { reactive,computed } from 'vue'
	let person = reactive({
		firstName:'尤',
		lastName:'大'
	});
	// 计算属性-简写
	const fullname1 = computed(()=>{
		return `${person.firstName}-${person.lastName}`
	})
	// 计算属性-完整
	const fullname2 = computed({
		get(){
			return `${person.firstName}-${person.lastName}`
		},
		set(value){
			const nameArr = value.split('-')
			person.firstName = nameArr[0]
			person.lastName = nameArr[1]
		}
	})
</script>

<style scoped>

</style>
